#ifndef _VIDEO_LOOPER
#define _VIDEO_LOOPER

#include "ofMain.h"
#include "videoMasker.h"


#define 	NUM_FRAMES_MEMORY		120


class videoLooper {
	
	public:
		
		void 				setup(int width, int height); 
		void 				startRecording();
		void 				endRecording();
		void				update(ofVideoGrabber * vidGrabber, videoMasker * mask);
		void 				draw();
		void 				setLooping(bool bLoop);
		
		
		unsigned char 		* videoFrameWithAlpha;
		ofTexture			videoTexture[NUM_FRAMES_MEMORY];
		float 				timeOfFrame[NUM_FRAMES_MEMORY];
		
		//---------------------------------- states
		bool 				bLooping;
		bool 				bRecording;
		bool				bFirstFrameRecording;
		
		//---------------------------------- recording
		float 				endTime;
		float 				startTime;
		int					nFrameRecorded;
		int 				currFrame;
		float 				recordingTimer;
		
		//---------------------------------- looping
		float 				loopTime;
		bool 				bLoopForward;
		int 				loopFrame;
		float 				lastUpdateTime;
		
		
		
		
		
		
		
};

#endif	
